//
//  PYChatManager.swift
//  SheYangBigData
//
//  Created by 叁拾叁 on 2021/4/2.
//  Copyright © 2021 叁拾叁. All rights reserved.
//

import UIKit
import RxSwift

class PYChatManager: NSObject {
    
    var requestVM: RYNongchangListVM = RYNongchangListVM()
    let dispose = DisposeBag()
    
    static let share = PYChatManager()
    
    func sendMessage(params: [String: String], complete:@escaping (Bool)->()) {
        requestVM.baseRequest(disposeBag: dispose, type: .im_sendMessages(dic: params), modelClass: SGBaseModel<PYCreatChatRoomModel>.self) {[weak self] (res) in
            if let `self` = self {
                complete(true)
                
                DispatchQueue.main.async {
                    
                }
            }
            
        } Error: {
            complete(false)
        }
    }
    
    func getMessages(complete:@escaping (Bool)->()) {
        requestVM.baseRequest(disposeBag: dispose, type: .im_getMessage, modelClass: SGBaseModel<PYCreatChatRoomModel>.self) {[weak self] (res) in
            if let `self` = self {
                complete(true)
                
                DispatchQueue.main.async {
                    
                }
            }
            
        } Error: {
            complete(false)
        }
    }
}
